# $Id: PKGBUILD 57381 2011-10-26 16:44:58Z jlichtblau $
# Maintainer: Jaroslav Lichtblau <dragonlord@aur.archlinux.org>

pkgname=sdcv
pkgver=0.4.2
pkgrel=6
pkgdesc="StarDict Console Version"
arch=('i686' 'x86_64')
url="http://sdcv.sourceforge.net/"
license=('GPL')
depends=('glib2' 'readline' 'zlib')
makedepends=('patch')
provides=('stardict')
changelog=$pkgname.changelog
source=(http://downloads.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.bz2 \
        $pkgname-$pkgver-headers.patch)
sha256sums=('a164f079e93986814ea2d39f3a49cf9d1b71b01aad908254457fe3d0ded9deb2'
            '4746e32a6aaddf7744f373b539879598b48219a3b35f41ceb839f04c27921eb4')

build() {
  cd ${srcdir}/$pkgname-$pkgver

  patch -Np1 -i ${srcdir}/$pkgname-$pkgver-headers.patch

  ./configure --prefix=/usr  --mandir=/usr/share/man

#quick fix for x86_64
  if [ "${CARCH}" == "x86_64" ]; then
    sed -i 's|guint32 page_size|guint64 page_size|' src/lib/lib.cpp
  fi

  make
}

package() {
  cd ${srcdir}/$pkgname-$pkgver

  make DESTDIR=${pkgdir} install
}
